<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});


/**
 * 上传图片路由
 */
Route::resource('photo', 'PhotoController', ['only' => ['store']]);

/**
 * 错误日志
 */
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index')->name('logs');

/**
 * 后台路由设置
 */
Route::group(['prefix' => 'admin'], function () {

    Auth::routes(); //登录注册路由
    Route::group(['namespace' => 'Admin', 'middleware' => ['auth', 'sitebar','role']], function () {
//         控制器在 "App\Http\Controllers\Admin" 命名空间下
        Route::get('/', 'HomeController@index')->name('admin.index');

        //商品管理
        require 'admin/shop.php';
        //广告管理
        require 'admin/ads.php';
        //微信管理
        require 'admin/wechat.php';
        //系统管理
        require 'admin/system.php';
        //CRM管理
        require 'admin/crm.php';
    });
});


/**
 * 商城前端页面  , 'middleware' => ['wechat','wechat.oauth']
 */
//Route::group(['namespace' => 'Wechat', 'middleware' => ['wechat', 'wechat.oauth']], function () {
Route::group(['namespace' => 'Wechat'], function () {
    require 'wechat/shop.php';
});


